"""
Configuration management for the guess-the-number game.
"""
import os
from dataclasses import dataclass


@dataclass
class Config:
    """Application configuration."""
    # 安全密钥 - 生成强随机密钥作为默认值
    SECRET_KEY: str = os.environ.get(
        "FLASK_SECRET_KEY",
        "7df090f2918238f060ac50dda0cbe09fd1c7291d391fbe58b34b575731f1d7c4"
    )

    # 游戏配置
    MIN_NUMBER: int = 1
    MAX_NUMBER: int = 100

    # 服务器配置
    PORT: int = int(os.environ.get("PORT", "21125"))
    DEBUG: bool = os.environ.get("FLASK_DEBUG", "False").lower() == "true"

    # 难度级别配置
    DIFFICULTIES = {
        "easy": {"min": 1, "max": 50, "label": "简单 (1-50)"},
        "medium": {"min": 1, "max": 100, "label": "中等 (1-100)"},
        "hard": {"min": 1, "max": 500, "label": "困难 (1-500)"},
        "expert": {"min": 1, "max": 1000, "label": "专家 (1-1000)"}
    }

    # 游戏统计配置
    MAX_HISTORY_RECORDS: int = 100  # 最大历史记录数


# 全局配置实例
config = Config()
